package com.ruoyi.warning.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.warning.domain.entity.Customoids;
import com.ruoyi.warning.domain.query.CustomoidsQuery;
import com.ruoyi.warning.mapper.CustomoidsMapper;
import com.ruoyi.warning.service.ICustomoidsService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author chenhc
 * @since 2025-05-08
 */
@Service
public class CustomoidsServiceImpl extends ServiceImpl<CustomoidsMapper, Customoids> implements ICustomoidsService {

    @Override
    public TableDataInfo getPage(CustomoidsQuery query) {
        Page<Object> page = PageHelper.startPage(query.getPageNum(),query.getPageSize());
        LambdaQueryWrapper<Customoids> wrapper = new QueryWrapper<Customoids>().lambda()
                .eq(query.getDeviceId()!=null,Customoids::getDeviceId,query.getDeviceId());
        List<Customoids> list1 = this.list(wrapper);
        TableDataInfo tableDataInfo = new TableDataInfo(list1, page.getTotal());
        return tableDataInfo;
    }
}
